<?php

class Post implements ArrayAccess, Iterator
{
    private $position = 0;
    private $keys = null;
    private $keyscount = 0;

    function __construct()
    {
        //smile ^_^
    }

    function offsetGet($name)
    {
        return isset($_POST[$name]) ? $_POST[$name] : null;
    }

    function offsetSet($name,$val)
    {
        $_POST[$name] = $val;
    }

    function offsetExists($name)
    {
        return isset($_POST[$name]);
    }

    function offsetUnset($name)
    {
        unset($_POST[$name]);
    }

    function Set($name,$val, $time)
    {
        $_POST[$name] = $val;
    }

    function rewind()
    {
        $this->position = 0;
        if(! $this->keys)
        {
            $this->keys = array_keys($_POST);
            $this->keyscount = count($this->keys);
        }
    }

    function current()
    {
        return $_POST[$this->keys[$this->position]];
    }

    function key()
    {
        return $this->keys[$this->position];
    }

    function next()
    {
        ++$this->position;
    }

    function valid()
    {
        return $this->position < $this->keyscount && isset($_POST[$this->keys[$this->position]]);
    }

    function GetRaw()
    {
        return $_POST;
    }

};

?>